Introduction
Nub is an all-in-one Rust toolkit for Node.js. Run TypeScript files and scripts, install dependencies, and manage Node itself — on the Node you already have, with no lock-in.
Nub is an all-in-one toolkit for Node.js, written in Rust. One binary runs your TypeScript files and scripts, installs your dependencies, and provisions Node itself — replacing node, npm/pnpm, npx, and nvm without adopting a new runtime.
npm install -g --ignore-scripts=false @nubjs/nub
nub index.ts # run a TypeScript file
nub install # install dependencies (pnpm-compatible)
nub run dev # run a package.json script
nubx prisma generate # run a CLI from node_modules/.binThere is no new runtime to adopt and no lock-in: every augmentation rides on Node's own public extension surfaces, and the package manager reads and writes whatever lockfile your project already uses.
The toolkit
- A runtime — execute
.{js,cjs,mjs,jsx,ts,cts,mts,tsx}files with full TypeScript support, on the stocknodebinary. See files. - A package manager — a pnpm-compatible installer that round-trips your existing npm, pnpm, or bun lockfile. See install.
- A script runner — run
package.jsonscripts 24× faster thanpnpm run, with the full workspace and lifecycle-hook surface preserved. See run. - A bin runner — run a local CLI an order of magnitude faster than
npx, or fetch and run an uninstalled one from the registry. See nubx. - A Node version manager — pin a version and Nub provisions it from nodejs.org on demand, replacing
nvmandfnm. See node. - A watcher — restart on changes to your source, your
.env*files, and yourtsconfig.json, driven by the dependency graph. See watch. - A GitHub Action — swap
actions/setup-nodefornubjs/setup-nubto install Nub, warm the project's Node, and cache Nub's store in CI. See GitHub Action.
What Nub replaces
| Nub | Instead of |
|---|---|
nub <file> | node, tsx, ts-node, dotenv-cli |
nub run <script> | npm run, pnpm run, yarn run |
nubx | npx, pnpm dlx, pnpm exec, yarn dlx |
nub install | npm, pnpm, yarn |
nub watch | nodemon, node --watch, tsx watch |
nub node | nvm, fnm, n, volta |
nub pm | corepack |
Install
npm install -g --ignore-scripts=false @nubjs/nubBoth pnpm add -g @nubjs/nub and yarn global add @nubjs/nub work equivalently. That installs the Rust binary plus the platform-specific N-API addons, and puts nub and nubx on your PATH. On macOS and Linux, Homebrew works too:
brew install nubjs/tap/nubFor containers, the official image ghcr.io/nubjs/nub is a node base with Nub layered on. See Docker:
FROM ghcr.io/nubjs/nubIn CI, swap actions/setup-node for the setup-nub action:
- - uses: actions/setup-node@v4
+ - uses: nubjs/setup-nub@v0Package management
The installer is pnpm-compatible at the CLI surface and lockfile-compatible with whatever your project already uses. It infers the incumbent package manager and mirrors it — npm, pnpm, and bun lockfiles round-trip cleanly; yarn is read-only.
nub install # resolve + link node_modules into the existing lockfile
nub add -E -D react # exact pin, devDeps — pnpm flag spelling
nub remove lodash
nub update
nub ci # frozen-lockfile installIt's optional: keep running your existing package manager and reach for Nub for everything else. See install for lockfile fidelity per incumbent, and pm for provisioning the exact package-manager version a project pins.
Requirements
- Node 18.19+ (Node 18 LTS) for augmented modes.
- macOS (arm64, x64), Linux (x64, arm64), Windows (x64, arm64).
Where to next
- Quick answers: the FAQ.